package cn.cy.behavior.observer.inter.general;

/**
 * @author yangxq
 * @desc
 * @date 2025-05-11
 */
public class Stock {

    private String name;
    private double price;

    public Stock(String name, double price) {
        this.name = name;
        this.price = price;
    }

    public void setPrice(double price) {
        this.price = price;
        updateUI();  // 直接更新UI
    }

    public double getPrice() {
        return price;
    }

    private void updateUI() {
        System.out.println("Stock " + name + " price updated to " + price);
    }

}
